package com.example.testhilt.module

import androidx.hilt.lifecycle.ViewModelInject
import androidx.lifecycle.ViewModel
import dagger.hilt.android.scopes.ActivityRetainedScoped
import javax.inject.Inject

/**
 ********************************************************
 *Author: chinadragon
 *Time: 2020/11/24 3:50 PM
 *Name: ViewModel的依赖注入
 *Overview:
 *  https://mp.weixin.qq.com/s/OEX1d2cU1zGG5BBM-nANBg
 *Usage:
 ********************************************************
 */
//@ActivityRetainedScoped
//class MyViewModel @Inject constructor(val repository: Repository) : ViewModel() {


//对于ViewModel这种常用Jetpack组件，Hilt专门为其提供了一种独立的依赖注入方式
class MyViewModel @ViewModelInject constructor(val repository: Repository) : ViewModel() {
}